"use strict"

this.ShapeType =

  get: (t) ->
    _.extend {}, ShapeType[t], { type: t }

  all: () ->
    k for k, v of ShapeType when v not instanceof Function and k != 'trash'

  menu:
    w: 120
    h: 30
    dropable:
      page:
        align: { top: true, right: true }

  view:
    w: 300
    h: 300
    droptarget: true
    dropable:
      page: {}

  list:
    w: 200
    h: 200
    droptarget: true
    dropable:
      view: {}

  text:
    w: 100
    h: 30
    dropable:
      view:
        width: 'max',
        align: { top: true, left: true, right: true }
      list:
        width: 'max',
        align: { top: true, left: true, right: true }

  edit:
    w: 100
    h: 30
    dropable:
      view:
        align: { top: true, left: true, right: true }

  button:
    w: 50
    h: 30
    dropable:
      view: {}

  select:
    w: 100
    h: 30

  image:
    w: 80
    h: 80

  page:
    x: 0
    w: 500
    h: 580
    droptarget: true
    dropable: {}
    bounding: { x: 0, y: 0, x1: global.bounding_w, y1: global.bounding_h }
    behavior: { move: { x: false, y: false }, resize: { x: false, y: false }}

  trash:
    x: global.bounding_w - 49
    w: 49
    h: 580
    droptarget: true
    dropable: {}
    bounding: { x: 0, y: 0, x1: global.bounding_w, y1: global.bounding_h }
    behavior: { move: { x: false, y: false }, resize: { x: false, y: false }}


# FIXME
this.getDropableOptions = (parent, child) ->
  if parent.settings.type == 'trash'
    return {
      align: {}
    }

  res = ShapeType[child.settings.type].dropable[parent.settings.type]
  res.align ||= {}
  res
